import { ResultCallback, SDKShareParam, ShareType, SDKShareState } from "../../SDKDefine";
import { BaseSDK } from "../base/BaseSDK";


export abstract class BaseShare extends BaseSDK {

    protected state: SDKShareState = SDKShareState.hide;

    protected callback: ResultCallback = null

    protected data: ShareType[];


    setData(data: ShareType[]) {
        this.data = data;
    }
    protected getData(site: number): any {
        let data = this.data[site]
        return data;
    }
    protected index: number = 0;

    setIndex(idx: number): void {
        this.index = idx;
    }
    init() {

    }
    /**
     * 
     * @param title  分享标题
     * @param func 分享回调函数
     * @param videoPath 是否分享录屏 
     */
    abstract open(param: SDKShareParam): void

    // shareWithUrl(index: number, url: string, func?: ResultCallback) {

    // }

    getShareInfo(shareTicket: string, func: (result: any) => void) {
        if (shareTicket) {
            this.sdk.getShareInfo({
                shareTicket: shareTicket,
                success: (res: any) => {
                    func(res)
                },
                fail: () => {

                }
            });
        }

    }


}
